<div class="blog-min-search">
    <input type="text" id="searchKey" value="{$keyword|default=''}" class="search-key" placeholder="请输入关键字" />
    <input type="button" id="searchBtn" value="搜索" class="search-btn" />
</div>
<div class="blog-cate">
    <div class="blog-title">栏目分类<a href="/blog/lists">全部></a></div>
    <div class="blog-cate-li">
        <ul>
            {huiblog:cates item="vo"}
            <li><a href="{$vo.url}">{$vo.title}<span>{$vo.count}</span></a></li>
            {/huiblog:cates}
        </ul>
    </div>
</div>
<div class="blog-ad">
    {huiblog:slides item="vo" slide_id="2" num="1" order="sort asc"}
    <a href="{$vo.src}" target="_blank">
        <img src="{$vo.img}" alt="{$vo.title}">
    </a>
    {/huiblog:slides}
</div>
<div class="blog-tags">
    <div class="blog-title">标签云</div>
    {huiblog:hotTag item="vo" num="20" order="rand()"}
    <a href="{$vo.url}" title="{$vo.title}">#{$vo.title}</a>
    {/huiblog:hotTag}
</div>
<div class="blog-random">
    <div class="blog-title">推荐文章</div>
    <ul>
        {huiblog:lists item="vo" num="5" type="3"}
        <li class="text-overflow-1"><a href="{$vo.url}">{$vo.title}</a></li>
        {/huiblog:lists}
    </ul>
</div>
<script>
  //搜索
  $('#searchBtn').on('click', function() {
    var val = $('#searchKey').val();
    if (val == '') {
      layer.msg('请输入搜索关键字');
      return;
    }
    window.location.href = "/blog/search?keyword=" + val;
  });

  $('#searchKey').on('keydown', function(e) {
    var ev = e || window.event;
    if (ev.keyCode == 13) {
      $('#searchBtn').click();
    }
  });
</script>
